package com.sx.zongzhi.activity;


import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.sx.zongzhi.BaseActivity;
import com.sx.zongzhi.R;
import com.sx.zongzhi.bean.MsgEvent;
import com.sx.zongzhi.bean.WorkLogRefreshBean;
import com.sx.zongzhi.utils.BaseUtil;
import com.sx.zongzhi.utils.MyRxBus;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class WorkLogSearchActivity extends BaseActivity {

    @BindView(R.id.et_Title)
    EditText et_Title;
    @BindView(R.id.et_Worker)
    EditText et_Worker;
    @BindView(R.id.tv_StartTime)
    TextView tv_StartTime;
    @BindView(R.id.tv_EndTime)
    TextView tv_EndTime;

    @Override
    public void setUI(Bundle savedInstanceState) {
        setContentView(R.layout.activity_work_log_search);
        setTitleName("工作日志查询");
        setTitleRight(R.string.search);
//        setTitleLeft(R.string.cancel);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.tv_right,R.id.tv_StartTime,R.id.tv_EndTime})
    public void OnClick(View view){
        switch (view.getId()){
            case R.id.tv_right://查询
                WorkLogRefreshBean workLogRefreshBean = new WorkLogRefreshBean();
                workLogRefreshBean.searchTitle = et_Title.getText().toString().trim();
                workLogRefreshBean.searchTimeStart = tv_StartTime.getText().toString().trim();
                workLogRefreshBean.searchTimeEnd = tv_EndTime.getText().toString().trim();
                MyRxBus.get().post(new MsgEvent("WorkLogActivity",2,workLogRefreshBean));
                finish();
                break;
            case R.id.tv_StartTime:
                BaseUtil.createDataPop(this,tv_StartTime);
                break;
            case R.id.tv_EndTime:
                BaseUtil.createDataPop(this,tv_EndTime);
                break;

        }
    }
}
